package org.lq.dlz.dao.impl;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.lq.dlz.dao.Coupon_historyDao;
import org.lq.dlz.entity.Coupon_history;
import org.lq.dlz.util.JDBCUtils;

public class Coupon_historyDaoImpl implements Coupon_historyDao {
	private QueryRunner qr = new QueryRunner(JDBCUtils.getDataSource());
	@Override
	public int addCoupon_history(Coupon_history history) {
		String sql="INSERT INTO `dlz_shopping`.`coupon_history`(`coupon_id`, `member_id`, `order_id`, `coupon_code`, `member_nikname`, `get_type`, `create_time`, `use_status`, `order_sn`, `use_time`) VALUES (?,?,?,?,?,?,?,?,?,?)";

		try {
			return qr.update(sql, history.getCoupon_id(),history.getMember_id(),history.getOrder_id(),history.getCoupon_code(),history.getMember_nikname(),history.getCreate_time(),history.getUse_status(),history.getOrder_sn(),history.getUse_time());
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return 0;
	}

}
